package com.example.bean;

public class Product {
    private Integer id;
    private String name;
    private Double price;

    // 必须有无参构造方法（Spring默认调用）
    public Product() {}

    // getter和setter（Spring通过setter注入属性）
    public Integer getId() { return id; }
    public void setId(Integer id) { this.id = id; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public Double getPrice() { return price; }
    public void setPrice(Double price) { this.price = price; }

    // 重写toString，方便打印信息
    @Override
    public String toString() {
        return "Product{id=" + id + ", name='" + name + "', price=" + price + "}";
    }
}

